﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using LUStationery.Controller;

public partial class GenerateDiscrepancy : System.Web.UI.Page
{
    CategoryListControl cListCtrl;
    ItemListControl iListCtrl;
    protected void Page_Load(object sender, EventArgs e)
    {
        cListCtrl = new CategoryListControl();
        iListCtrl = new ItemListControl();
        if (!IsPostBack)
        {
            populateCategory();
            populateItem();
        }
    }
    protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtDescription.Text = ddlCategory.SelectedValue.ToString();
    }
    public void populateCategory() 
    {
        ddlCategory.DataSource = cListCtrl.getCategories();
        ddlCategory.DataTextField = "CategoryID";
        ddlCategory.DataValueField = "CategoryID";
        ddlCategory.DataBind();
    }
    public void populateItem()
    {
        ddlItemNo.DataSource = iListCtrl.getItemList();
        ddlItemNo.DataTextField = "ItemNumber";
        ddlItemNo.DataValueField = "ItemDesc";
        ddlItemNo.DataBind();
    }
    protected void ddlItemNo_SelectedIndexChanged(object sender, EventArgs e)
    {
        txtDescription.Text = ddlItemNo.SelectedValue.ToString();
    }
}